package QuanLyNhanSu;

import java.sql.SQLException;
import java.sql.*;
public class TestDatabaseMetadata {
	static Conn c;
	//String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Hoc Tap\\Hoc Ki VII\\Chuyen De Java\OnTap_Code\\OnTap\\src\\QuanLyNhanSu";
	public static void main(String[] a){
		c = new Conn("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Hoc Tap\\Hoc Ki VII\\Chuyen De Java\\OnTap_Code\\OnTap\\src\\QuanLyNhanSu\\QLNhanSu.mdb;}", "", "");
		
		try {
			DatabaseMetaData dbMD = c.conn.getMetaData();
			String[] tName = {"TABLE"};  
			System.out.println("Cac bang co trong csdl:");
			ResultSet tName1 = dbMD.getTables(null, null , null, tName);
			while (tName1.next()){
				System.out.println(tName1.getString("TABLE_NAME"));
				
			}
		
			System.out.println("URL in use: " + dbMD.getURL());
		    System.out.println("User name: " + dbMD.getUserName());
		    System.out.println("DBMS name: " + dbMD.getDatabaseProductName());
		    System.out.println("DBMS version: " + dbMD.getDatabaseProductVersion());
		    System.out.println("Driver name: " + dbMD.getDriverName());
		    System.out.println("Driver version: " + dbMD.getDriverVersion());
		    System.out.println("supp. SQL Keywords: " + dbMD.getSQLKeywords());
			
		} catch (SQLException e1) {
			e1.printStackTrace();
		}
	}
}

